<template>
  <div>
    <div class="header">
      <h2>我的</h2>
    </div>
    <div class="user">
      <div class="user-pic">
        <img src="../assets/img/pic-Photo.png" alt="" />
      </div>
      <div class="user-right">
        <div class="not-login">
          <p ref=p1 style="padding-left:12px">
            <router-link to="/login" >登录</router-link>
            <router-link to="/register" >注册</router-link>
          </p>
          <p class="clo-f63" ref='p2'>登录后享受更多服务</p>
           <p style="color:#333; padding-left:10px" @click='quit' v-if="isShow">注销</p>`
        </div>
      </div>
    </div>
    <div class="user-list">
      <div class="table-view">
        <router-link class="bar" to="coupons">
          现金券
          <span> <b></b> </span
        ></router-link>
        <a href="" class="bar">
          邀请有奖
          <span> <b></b> </span
        ></a>
        <a href="" class="bar">
          活动提交
          <span> <b></b> </span
        ></a>
      </div>
      <div class="table-view">
        <a href="" class="bar">
          个人中心
          <span> <b></b> </span
        ></a>
        <a href="" class="bar">
          密码管理
          <span> <b></b> </span
        ></a>
        <a href="" class="bar">
          财务中心
          <span> <b></b> </span
        ></a>
      </div>
      <div class="table-view">
        <a href="" class="bar">
          我要吐槽
          <span> <b></b> </span
        ></a>
        <a href="" class="bar">
          帮助中心
          <span> <b></b> </span
        ></a>
        <a href="" class="bar">
          联系我们
          <span> <b></b> </span
        ></a>
      </div>
    </div>
  <Footer/>
  </div>
</template>

<script>
import Footer from "@/components/footer.vue";
import {mapState} from 'vuex'
export default {
   components: {
    Footer,
  },
  computed: {
   ...mapState({
      homenum:state=>state.home.homenum
    })
  },
  data() {
    return {
     isShow:false
    }
  },
  methods: {
    quit() {
      this.$store.commit('user/initUserInfoMut',0)
      this.$router.push("/");
      this.$store.commit('home/changehomenum',0)
    }
  },
  mounted () {
    if(localStorage.userInfo){
        // console.log(JSON.parse(sessionStorage.userInfo));
        this.isShow=true
        this.$refs.p1.innerHTML='用户名：'+JSON.parse(localStorage.userInfo).username
         this.$refs.p2.innerHTML=`
         代练员等级：初级`
         return
    }
  },
};
</script>

<style src="../assets/css/person.css" scoped>
</style>
